package com.ssy.lingxi.enhance.entity;


import com.ssy.lingxi.enhance.handler.convert.JpaJsonToMapConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashMap;

/**
 * 生产通知单明细 - DO
 * @author fhj
 * @date 2020/10/15
 * @version 2.0.0
 */
@Data
@Entity
@Table(schema = "public", name = "enhance_produce_notice_order_detail", indexes = {
        @Index(name = "enhance_produce_notice_order_detail_produce_notice_order_id_idx", columnList = "produceNoticeOrderId")
})
public class ProduceNoticeOrderDetailDO implements Serializable {
    private static final long serialVersionUID = -6936239692606654618L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "produce_notice_order_detail_seq")
    @SequenceGenerator(sequenceName = "enhance_produce_notice_order_detail_seq", name = "produce_notice_order_detail_seq", allocationSize = 1)
    @ApiModelProperty(value = "ID")
    private Long id;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "生产通知单ID")
    private Long produceNoticeOrderId;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "订单ID")
    private Long orderId;

    @Column(columnDefinition = "varchar(20)")
    @ApiModelProperty(value = "订单号")
    private String orderNo;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "订单详情ID")
    private Long orderDetailId;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "商品ID")
    private Long productId;

    @Column(columnDefinition = "varchar(500)")
    @ApiModelProperty(value = "商品名称")
    private String productName;

    @Column(columnDefinition = "varchar(16)")
    @ApiModelProperty(value = "品类")
    private String category;

    @Column(columnDefinition = "varchar(20)")
    @ApiModelProperty(value = "品牌")
    private String brand;

    @Column(columnDefinition = "varchar(16)")
    @ApiModelProperty(value = "单位")
    private String unit;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "采购数量（订单数量）")
    private Double purchaseCount;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "剩余加工数量")
    private Double surplusProcessNum;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "加工数量")
    private Double processNum;

    @Column(columnDefinition = "int")
    @ApiModelProperty(value = "是否含税")
    private Integer isHasTax;

    @Column(columnDefinition = "decimal")
    @ApiModelProperty(value = "税率")
    private Double taxRate;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "加工单价")
    private Double processPrice;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "加工费")
    private Double processTotalPrice;

    @Convert(converter = JpaJsonToMapConverter.class)
    @Column(columnDefinition="jsonb")
    @ApiModelProperty(value = "商品属性")
    private HashMap<String, Object> property;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "发货数量")
    private Double deliverNum = 0.0;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "收货数量")
    private Double receiveNum = 0.0;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "未发货数量")
    private Double notDeliverNum;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "差异数量")
    private Double differenceNum = 0.0;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "创建时间")
    private Long createTime = System.currentTimeMillis();
}
